-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List fusion #22
base: master
Are you sure you want to change the base?
List fusion #22
Conversation
* Remove unnecessary constraints from `Data.BitSet.Generic`. * Use a more streamlined implementation of `foldl'` and `foldr'` when possible. * Update Cabal file to indicate required extensions. * Make the tests work again.
Make `fromList` fuse with `build` and `augment`, and make `toList` fuse with `foldr`. Express the `toList/fromList` rule in terms of rewrite helper targets; this has the pleasant side effect of letting it handle things like `fromList $ toList xs ++ toList ys`. Adjust arities of functions in `Data.BitSet.Word` to convince most of the underlying functions to inline. I *think* this is what we want.
@@ -124,7 +124,7 @@ insert = GS.insert | |||
|
|||
-- | /O(1)/. Delete an item from the bit set. | |||
delete :: Enum a => a -> BitSet a -> BitSet a | |||
delete = GS.delete | |||
delete x xs = GS.delete x xs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, could you explain why the arguments are necessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at the generated core with -O2. All will be fine if WS.delete is fully
applied and inlines, but if it's partially applied and passed to a
higher-order function that doesn't inline, the Bits dictionary may be
passed at runtime (I believe). The extra parameters there are to fully
apply GS.delete in WS.delete, so GHC will inline it when compiling
WS.delete.
On Jun 15, 2016 2:45 PM, "Sergei Lebedev" [email protected] wrote:
In src/Data/BitSet/Word.hs
#22 (comment):@@ -124,7 +124,7 @@ insert = GS.insert
-- | /O(1)/. Delete an item from the bit set.
delete :: Enum a => a -> BitSet a -> BitSet a
-delete = GS.delete
+delete x xs = GS.delete x xsHmm, could you explain why the arguments are necessary here?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/lambda-llama/bitset/pull/22/files/231962e0e6a63fe63e1952826f97ca529f20a4e5#r67221750,
or mute the thread
https://github.com/notifications/unsubscribe/ABzi_QRX_uV6tfFowIlj45kg27ygZu9Cks5qMEg4gaJpZM4IyfKO
.
If the "general improvements" PR is merged, I'll rebase this.